<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ include file="/pub/includ.jsp"%>
<%@ page import="com.wing.cms.ext.domain.*"%>
<%@ page import="com.wing.cms.domain.*"%>
<%@ page import="com.wing.common.util.*,java.util.*"%>
<%
	Portlet_C p = (Portlet_C)request.getAttribute("portlet_c");
	CustomMessageBoard cmb = new CustomMessageBoard();	
	if(p.getObject()!=null){	
		cmb = (CustomMessageBoard)p.getObjectView();
	}
%>
<script type="text/javascript">
	$(document).ready(function(){
	        $.formValidator.initConfig({formid:"messageBoardform",alertmessage:false,onerror:function(msg){alert(msg)}});
            
            $("#title").formValidator({empty:"true"}).inputValidator({min:1,max:250,onerror:"portlet名称过长"});
            $("#portletwidth").formValidator().inputValidator({min:0,max:1500,type:"value",onerror:"portlet宽度必须是0-1500之间的数组"});
            $("#portletheight").formValidator().inputValidator ({min:0,max:5000,type:"value",onerror:"portlet高度必须是0-5000之间的数组"});
	});
	
	var save = function(){
		var flag = "failure";
		if($.formValidator.pageIsValid()){
			var options = {
				type: 'POST',
				async: false,
				dataType: 'content-type',
				success: function(msg) {
						flag = "success";
				}
			}
			$('#messageBoardform').ajaxSubmit(options);
		}
		return flag;
	 }

	function selectImage(){
		opendailog("{src:'<%=path %>/res/get/selectImageIndex',title:'选取图片',width:600,height:400,savefunc:'savefunc2'}",window);
	}
	function savefunc2(frame){
		var retv = frame.contentWindow.save();
		if(retv){
			$('#titlepic').val(retv);
			return "success";		
		}
	}
</script>
<form id="messageBoardform"  action="<%=path%>/cms/portlet/saveportlet_c" method="post" target="_self">
<table><tr><td height="2px"></td></tr></table>
<table align="center" border="0" cellpadding="0" cellspacing="1" class="table_nbw" >
	<thead class="th_nbw">
	<tr>
		<td colspan="2" align="center"><strong>留言板展现设置</strong></td>
	</tr>
	</thead>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">显示模板</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="templateid" style="width:120">
			<c:forEach var="template" items="${templateList}"> 
				<option value='${template.id}' ${template.id==portlet_c.templateid?'selected':''}>
					${template.name}
				</option> 
			</c:forEach> 
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="title" name="title" value="${portlet_c.title}"></td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称展示类型</td>
		<td align="left" style="background-color:fff">&nbsp;
			<label><input type="radio" value="0" checked="checked" name="titletype" />样式</lable>
			&nbsp;&nbsp;&nbsp;&nbsp; 
			<label><input type="radio" value="1" ${portlet_c.titletype=="1"?'checked=checked':''} name="titletype" />图片</label>
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet名称样式</td>
		<td align="left" style="background-color:fff">&nbsp;
			<select name="titlecolor" style="width:120">
				<option value='portal_title1' ${portlet_c.titlecolor=='portal_title1'?'selected':''}>标题1</option> 
				<option value='portal_title2' ${portlet_c.titlecolor=='portal_title2'?'selected':''}>标题2</option> 
				<option value='portal_title3' ${portlet_c.titlecolor=='portal_title3'?'selected':''}>标题3</option> 
				<option value='portal_title4' ${portlet_c.titlecolor=='portal_title4'?'selected':''}>标题4</option> 
				<option value='portal_title5' ${portlet_c.titlecolor=='portal_title5'?'selected':''}>标题5</option> 
				<option value='portal_title6' ${portlet_c.titlecolor=='portal_title6'?'selected':''}>标题6</option> 
			</select>
		</td>
	</tr>
	<tr >
		<td align="right" width="30%"  style="background-color:fff;height:25px;">portlet名称图片</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="titlepic" name="titlepic" value="${portlet_c.titlepic}">
			<input type = "button"  value = "选择"  onclick = "selectImage();">
		</td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet宽度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="portletwidth" name="portletwidth" value="${portlet_c.portletwidth}"></td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">portlet高度</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="portletheight" name="portletheight" value="${portlet_c.portletheight}"></td>
	</tr>
	<tr >
		<td align="right" width="40%"  style="background-color:fff;height:25px;">显示的字段</td>
		<td align="left" style="background-color:fff">
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowTitle())){%>checked=checked<%} %> name="showTitle" />标题</label>
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowContent())){%>checked=checked<%} %> name="showContent" />内容</label><br/>
		
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowName())){%> checked=checked<%} %> name="showName" />姓名</label>
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowSex())){%>checked=checked<%} %> name="showSex" />性别</label>
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowEmail())){%>checked=checked<%}%> name="showEmail" />email</label>
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowPhone())){%>checked=checked<%}%> name="showPhone" />电话</label><br/>
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowMobile())){%>checked=checked<%}%> name="showMobile" />手机</label>
			<label><input type="checkbox" value="1" <% if("1".equals(cmb.getShowAddress())){%>checked=checked<%}%> name="showAddress" />地址</label>
		</td>
	</tr>
</table>

<input type="hidden" name="id" value="${portlet_c.id}" />
<input type="hidden" id="portletype" name="portletype" value="${portletype}">
<input type="hidden" name="horderChannelId" value="${param.horderChannelId}"/>
<input type="hidden" name="placeholderId" value="${param.placeholderId}"/>
</form>


